# @Author   : tan90
# @Time     : 2025/6/25 13:59
import uuid

from fastapi import FastAPI, Request, Response

app = FastAPI()


async def form_data(request: Request) -> dict:
    form = await request.form()
    params: dict = {}
    for key, value in form.multi_items():
        params[key] = value
    print("form_data", params)
    return params


def query_params_data(request: Request) -> dict:
    params: dict = {}
    for key, value in request.query_params.multi_items():
        params[key] = value
    print("query_params_data", params)
    return params


# 体能8项
@app.get("/creasen/tracking/mSetRawData")
async def physical_fitness(request: Request):
    query_params_data(request)
    return Response(content=f"{uuid.uuid4()}", media_type="text/plain")


# 体能4项
@app.get("/creasen/tracking/mSetRaw4Data")
async def physical_fitness_4(request: Request):
    query_params_data(request)
    return Response(content=f"{uuid.uuid4()}", media_type="text/plain")


# 体质
@app.get("/creasen/tracking/mSetPhysiqueData")
async def physique_data(request: Request):
    query_params_data(request)
    return Response(content=f"{uuid.uuid4()}", media_type="text/plain")


# 体态
@app.post("/creasen/tracking/mSetPostureData")
async def posture_data(request: Request):
    query_params_data(request)
    await form_data(request)
    return Response(content=f"{uuid.uuid4()}", media_type="text/plain")


if __name__ == '__main__':
    import uvicorn

    uvicorn.run(app, host="0.0.0.0", port=8000)
